package project.parser.ast.aux;

import project.environments.DynamicEnv;
import project.environments.StaticEnv;
import project.environments.Value;
import project.parser.ast.exps.Exp;
import project.parser.ast.types.Type;

import java.util.LinkedList;
import java.util.List;

public class AuxExpList<T extends Exp> extends AuxList<T> { //classe di appoggio per liste di espressioni

	public AuxExpList(List<T> list) {
		super(list);
	}

	public List<Type> typecheckList(StaticEnv senv) {
		List<Type> types = new LinkedList<>();
		for (Exp exp : this)
			types.add(exp.typecheck(senv));
		return types;
	}

	public List<Value> evaluateList(DynamicEnv denv) {
		List<Value> values = new LinkedList<>();
		for (Exp exp : this)
			values.add(exp.evaluate(denv));
		return values;
	}
}
